<template>
  <div class="main_pop">
    <div class="pop" v-for="(item, index) in popupShowList" :key="index">
      {{ item.title }}：
      <el-switch
        v-model="item.model"
        inline-prompt
        active-text="是"
        inactive-text="否"
        @change="item.swHandel"
      />
    </div>
  </div>
</template>

<script>
import { defineComponent, reactive, ref, onMounted } from 'vue';
import { autoLikesHandel } from './likes';
export default defineComponent({
  setup() {
    const popupShowList = reactive([
      {
        title: '开启自动点赞',
        model: ref(false),
        swHandel: autoLikesHandel,
      },
    ]);
    onMounted(() => {
      chrome.storage.local.get({ autoLikes:false }, (result) => {
        popupShowList[0].model = result.autoLikes;
      });
    });
    return {
      popupShowList,
    };
  },
});
</script>

<style scoped>
.main_pop {
  width: 130px;
}
.pop {
  display: flex;
  align-items: center;
}
</style>
